﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace reflex.utils
{
    public static class EnumExtend
    {
        public static string getDescription(this OrderStateEnum state)
        {
            Type type = typeof(OrderStateEnum);
            // 获取字段
            var filedInfo = type.GetField(state.ToString());
            // 获取自定义属性
            var description = filedInfo.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
            return description.Description;
        }
    }
}
